function BattleMenu_Item()
{
RenderMap();

  BattleName(); 
  DrawPlayerStats();
  
  var BattleMenuItem = new Menu();
  BattleMenuItem.font         = Font;
  BattleMenuItem.window_style = WindowStyle;
  BattleMenuItem.arrow        = Arrow;
  if (Player.items.potion >= 1)
  {
  BattleMenuItem.addItem("Potion: " + Player.items.potion, BattleMenu_Itempotion);
  }
  if (Player.items.hipotion >= 1)
  {
  BattleMenuItem.addItem("Hi-Potion: " + Player.items.hipotion, BattleMenu_Itemhipotion);
  }
  if (Player.items.fullpotion >= 1)
  {
  BattleMenuItem.addItem("Full Potion: " + Player.items.fullpotion, BattleMenu_Itemfullpotion);
  }
  if (Player.items.life >= 1)
  {
  BattleMenuItem.addItem("Life: " + Player.items.life, BattleMenu_Itemlife);
  }
  if (Player.items.ether >= 1)
  {
  BattleMenuItem.addItem("Ether: " + Player.items.ether, BattleMenu_Itemether);
  }
  if (Player.items.turboether >= 1)
  {
  BattleMenuItem.addItem("Turbo Ether: " + Player.items.turboether, BattleMenu_Itemturboether);
  }
  if (Player.items.elixer >= 1)
  {
  BattleMenuItem.addItem("Elixer: " + Player.items.elixer, BattleMenu_Itemelixer);
  }
  BattleMenuItem.addItem("Cancel",  BattleMenu_ItemCancel);
  BattleMenuItem.execute(5, 355, 235, 120);
}
function BattleMenu_ItemCancel()
{
  if (Player.active == "Player1")
  {
  BattleMenuPlayer1();
  }
  else if (Player.active == "Player2")
  {
  BattleMenuPlayer2();
  }
  else
  {
  BattleMenuPlayer3();
  }
}
function BattleMenu_Itempotion()
{
Player.temp = "Potion"
Player.temphpeffect = 50;
Player.tempmpeffect = 0;
Player.templifeeffect = 0;
BattleMenu_ItemTarget();
}
function BattleMenu_Itemhipotion()
{
Player.temp = "Hi-Potion"
Player.temphpeffect = 250;
Player.tempmpeffect = 0;
Player.templifeeffect = 0;
BattleMenu_ItemTarget();
}
function BattleMenu_Itemfullpotion()
{
Player.temp = "Full Potion"
Player.temphpeffect = "Max";
Player.tempmpeffect = 0;
Player.templifeeffect = 0;
BattleMenu_ItemTarget();
}
function BattleMenu_Itemlife()
{
Player.temp = "Life"
Player.temphpeffect = 0;
Player.tempmpeffect = 0;
Player.templifeeffect = 1;
BattleMenu_ItemTarget();
}
function BattleMenu_Itemether()
{
Player.temphpeffect = 0;
Player.tempmpeffect = 50;
Player.templifeeffect = 0;
Player.temp = "Ether"
BattleMenu_ItemTarget();
}
function BattleMenu_Itemturboether()
{
Player.temphpeffect = 0;
 Player.tempmpeffect = "Max";
Player.templifeeffect = 0;
Player.temp = "Turbo Ether"
BattleMenu_ItemTarget();
}
function BattleMenu_Itemelixer()
{
Player.temphpeffect = "Max";
Player.tempmpeffect = "Max";
Player.templifeeffect = 0;
Player.temp = "Elixer"
BattleMenu_ItemTarget();
}
function BattleMenu_ItemTarget()
{
Player.BPMenuTemp = true;

RenderMap();

  BattleName(); 
  DrawPlayerStats();
  
  var BattleMenuItem = new BMenu();
  BattleMenuItem.font         = Font;
  BattleMenuItem.window_style = WindowStyle;
  BattleMenuItem.arrow        = Arrow;
  BattleMenuItem.addItem(Player.name,  BattleMenu_ItemUsePlayer1);
  if (Player2.pres == true)
  {
  BattleMenuItem.addItem(Player2.name,  BattleMenu_ItemUsePlayer2);
  }
  if (Player3.pres == true)
  {
  BattleMenuItem.addItem(Player3.name,  BattleMenu_ItemUsePlayer3);
  }
  BattleMenuItem.addItem("Cancel",  BattleMenu_Item);
  BattleMenuItem.execute(5, 355, 235, 40);
}
function BattleMenu_ItemUsePlayer1()
{
Player.playertemp = "Player1";
  if (Player.temphpeffect == "Max")
  {
  Player.temphpeffect = Player.maxmp;
  }
  if (Player.tempmpeffect == "Max")
  {
  Player.tempmpeffect = Player.maxmp;
  }
  if (Player.templifeeffect == 1)
  {
    if (Player.hp > 0)
    {
      Talk_Window("I don't need that!", Player.port);
      BattleMenu_Item();
    }
    else
    {
    Player.temphpeffect = Math.floor(Player.maxhp/5);
    BattleMenu_ItemUseItem();
    }
  }
  else
  {
  BattleMenu_ItemUseItem();
  }
}
function BattleMenu_ItemUsePlayer2()
{
Player.playertemp = "Player2";
  if (Player.temphpeffect == "Max")
  {
  Player.temphpeffect = Player2.maxmp;
  }
  if (Player.tempmpeffect == "Max")
  {
  Player.tempmpeffect = Player2.maxmp;
  }
  if (Player.templifeeffect == 1)
  {
    if (Player2.hp > 0)
    {
      Talk_Window("I don't need that!", Player2.port);
      BattleMenu_Item();
    }
    else
    {
    Player.temphpeffect = Math.floor(Player2.maxhp/5);
    BattleMenu_ItemUseItem();
    }
  }
  else
  {
  BattleMenu_ItemUseItem();
  }
}

function BattleMenu_ItemUsePlayer3()
{
Player.playertemp = "Player3";
  if (Player.temphpeffect == "Max")
  {
  Player.temphpeffect = Player3.maxmp;
  }
  if (Player.tempmpeffect == "Max")
  {
  Player.tempmpeffect = Player3.maxmp;
  }
  if (Player.templifeeffect == 1)
  {
    if (Player3.hp > 0)
    {
      Talk_Window("I don't need that!", Player3.port);
      BattleMenu_Item();
    }
    else
    {
    Player.temphpeffect = Math.floor(Player3.maxhp/5);
    BattleMenu_ItemUseItem();
    }
  }
  else
  {
  BattleMenu_ItemUseItem();
  }
}

function BattleMenu_ItemUseItem()
{
  if (Player.playertemp == "Player1")
  {
    if (Player.temphpeffect > 0)
    {
    ShowHeathGain(Player.temphpeffect);
    Player.hp = Player.hp + Player.temphpeffect;
      if (Player.hp > Player.maxhp)
      {
      Player.hp = Player.maxhp;
      }
    UpdatePlayers();        
    }
    if (Player.tempmpeffect > 0)
    {
    ShowMpGain(Player.tempmpeffect);
    Player.mp = Player.mp + Player.tempmpeffect;
      if (Player.mp > Player.maxmp)
      {
      Player.mp = Player.maxmp;
      }
    }
  }
  else if (Player.playertemp == "Player2")
  {
    if (Player.temphpeffect > 0)
    {
    ShowHeathGain(Player.temphpeffect);
    Player2.hp = Player2.hp + Player.temphpeffect;
      if (Player2.hp > Player2.maxhp)
      {
      Player2.hp = Player2.maxhp;
      }
    UpdatePlayers();        
    }
    if (Player.tempmpeffect > 0)
    {
    ShowMpGain(Player.tempmpeffect);
    Player2.mp = Player2.mp + Player.tempmpeffect;
      if (Player2.mp > Player2.maxmp)
      {
      Player2.mp = Player2.maxmp;
      }
    }
  }
  else if (Player.playertemp == "Player3")
  {
    if (Player.temphpeffect > 0)
    {
    ShowHeathGain(Player.temphpeffect);
    Player3.hp = Player3.hp + Player.temphpeffect;
      if (Player3.hp > Player3.maxhp)
      {
      Player3.hp = Player3.maxhp;
      }
    UpdatePlayers();        
    }
    if (Player.tempmpeffect > 0)
    {
    ShowMpGain(Player.tempmpeffect);
    Player3.mp = Player3.mp + Player.tempmpeffect;
      if (Player3.mp > Player3.maxmp)
      {
      Player3.mp = Player3.maxmp;
      }
    }
  }
ItemReduce();
BattleMenu_Itemused();
}

function BattleMenu_Itemused()  
{
UpdatePlayers();

  if (Player.active == "Player1")
  {
  BattleMenuPlayer2();
  }
  else if (Player.active == "Player2")
  {
  BattleMenuPlayer3();
  }
  else
  {
  MonstersTurn();
  }
}
function ItemReduce()
{
  if (Player.temp == "Potion")
  {
  Player.items.potion = Player.items.potion - 1;
  }
  else if (Player.temp == "Hi-Potion")
  {
  Player.items.hipotion = Player.items.hipotion - 1;
  }
  else if (Player.temp == "Full Potion")
  {
  Player.items.fullpotion = Player.items.fullpotion - 1;
  }
  else if (Player.temp == "Life")
  {
  Player.items.life = Player.items.life - 1;
  }
  else if (Player.temp == "Ether")
  {
  Player.items.ether = Player.items.ether - 1;
  }
  else if (Player.temp == "Turbo Ether")
  {
  Player.items.turboether = Player.items.turboether - 1;
  }
  else if (Player.temp == "Elixer")
  {
  Player.items.elixer = Player.items.elixer - 1;
  }  
}
  
function notenoughmp()
{
Talk_Window("Not Enough Mp", "blank.png")
GoToActivePlayer();
}


function BattleMenu_SpecialP1()
{
RenderMap();

  BattleName(); 
  DrawPlayerStats();
  
  var BattleMenuItem = new Menu();
  BattleMenuItem.font         = Font;
  BattleMenuItem.window_style = WindowStyle;
  BattleMenuItem.arrow        = Arrow;

  if (Player.active == "Player1")
  {
    if (Player.chrclass == "Mage")
    {
    BattleMenuItem.addItem("White", BattleSpecialMageWhite);
    BattleMenuItem.addItem("Black", BattleSpecialMageBlack);
    BattleMenuItem.addItem("Custom", BattleSpecialMageCustom);
    }
    if (Player.chrclass == "Bard")
    {
    BattleMenuItem.addItem("Song", BattleSpecialBardSong);
    BattleMenuItem.addItem("White", BattleSpecialMageWhite);
    BattleMenuItem.addItem("Black", BattleSpecialMageBlack);
    }
    if (Player.chrclass == "Ranger")
    {
    BattleMenuItem.addItem("Peep", BattleSpecialRangerPeep);
 
      if (Playerranger.animals == true)
      {
      BattleMenuItem.addItem("Animals", BattleSpecialRangerAnimals);
      }
      if (Playerranger.defup == true)
      {
      BattleMenuItem.addItem("Defense-Up", BattleSpecialMageDefup);    
      }
      if (Playerranger.powerup == true)
      {
      BattleMenuItem.addItem("Power-up", BattleSpecialMagePowerup);
      }
      if (Playerranger.evade == true)
      {
      BattleMenuItem.addItem("Evade-Up", BattleSpecialRangerEvade);
      }
      if (Playerranger.heal == true)
      {
      BattleMenuItem.addItem("Heal", BattleSpecialRangerHeal);
      }
      if (Playerranger.heal2 == true)
      {
      BattleMenuItem.addItem("Heal 2", BattleSpecialRangerHeal2);
      }
      if (Playerranger.heal3 == true)
      {
      BattleMenuItem.addItem("Heal 3", BattleSpecialRangerHeal3);
      }
    }
  }
  if (Player.active == "Player2")
  {
    if (Player2.chrclass == "Mage")
    {
    BattleMenuItem.addItem("White", BattleSpecialMageWhite);
    BattleMenuItem.addItem("Black", BattleSpecialMageBlack);
    BattleMenuItem.addItem("Custom", BattleSpecialMageCustom);
    }
    if (Player2.chrclass == "Bard")
    {
    BattleMenuItem.addItem("Song", BattleSpecialBardSong);
    BattleMenuItem.addItem("White", BattleSpecialMageWhite);
    BattleMenuItem.addItem("Black", BattleSpecialMageBlack);
    }

    if (Player2.chrclass == "Ranger")
    {
    BattleMenuItem.addItem("Peep", BattleSpecialRangerPeep);
 
      if (Player2ranger.animals == true)
      {
      BattleMenuItem.addItem("Animals", BattleSpecialRangerAnimals);
      }
      if (Player2ranger.defup == true)
      {
      BattleMenuItem.addItem("Defense-Up", BattleSpecialMageDefup);    
      }
      if (Player2ranger.powerup == true)
      {
      BattleMenuItem.addItem("Power-up", BattleSpecialMagePowerup);
      }
      if (Player2ranger.evade == true)
      {
      BattleMenuItem.addItem("Evade-Up", BattleSpecialRangerEvade);
      }
      if (Player2ranger.heal == true)
      {
      BattleMenuItem.addItem("Heal", BattleSpecialRangerHeal);
      }
      if (Player2ranger.heal2 == true)
      {
      BattleMenuItem.addItem("Heal 2", BattleSpecialRangerHeal2);
      }
      if (Player2ranger.heal3 == true)
      {
      BattleMenuItem.addItem("Heal 3", BattleSpecialRangerHeal3);
      }
    }
  }
  if (Player.active == "Player3")
  {
    if (Player3.chrclass == "Mage")
    {
    BattleMenuItem.addItem("White", BattleSpecialMageWhite);
    BattleMenuItem.addItem("Black", BattleSpecialMageBlack);
    BattleMenuItem.addItem("Custom", BattleSpecialMageCustom);
    }
    if (Player3.chrclass == "Bard")
    {
    BattleMenuItem.addItem("Song", BattleSpecialBardSong);
    BattleMenuItem.addItem("White", BattleSpecialMageWhite);
    BattleMenuItem.addItem("Black", BattleSpecialMageBlack);
    }

    if (Player3.chrclass == "Ranger")
    {
    BattleMenuItem.addItem("Peep", BattleSpecialRangerPeep);
 
      if (Player3ranger.animals == true)
      {
      BattleMenuItem.addItem("Animals", BattleSpecialRangerAnimals);
      }
      if (Player3ranger.defup == true)
      {
      BattleMenuItem.addItem("Defense-Up", BattleSpecialMageDefup);    
      }
      if (Player3ranger.powerup == true)
      {
      BattleMenuItem.addItem("Power-up", BattleSpecialMagePowerup);
      }
      if (Player3ranger.evade == true)
      {
      BattleMenuItem.addItem("Evade-Up", BattleSpecialRangerEvade);
      }
      if (Player3ranger.heal == true)
      {
      BattleMenuItem.addItem("Heal", BattleSpecialRangerHeal);
      }
      if (Player3ranger.heal2 == true)
      {
      BattleMenuItem.addItem("Heal 2", BattleSpecialRangerHeal2);
      }
      if (Player3ranger.heal3 == true)
      {
      BattleMenuItem.addItem("Heal 3", BattleSpecialRangerHeal3);
      }
    }
  }
  BattleMenuItem.addItem("Cancel", GoToActivePlayer);  
  BattleMenuItem.execute(5, 355, 235, 120);
}

function BattleSpecialRangerAnimals()
{
Player.temp = "Animals";
Player.techpower = 0.3;
BattleSpecialBardSongAttack();
}
function BattleSpecialRangerHeal()
{
CheckMp("Lv1");
  if (Player.needmp > Player.actmp)
  {
  Talk_Window("You don't have enough Mp!", "blank.png");
  GoToActivePlayer();
  }
  else
  {    
  Player.temp = "Heal"
  BattleSpecialRangerStuff()
  }
}
function BattleSpecialRangerHeal2()
{
CheckMp("Lv3");
  if (Player.needmp > Player.actmp)
  {
  Talk_Window("You don't have enough Mp!", "blank.png");
  GoToActivePlayer();
  }
  else
  {    
  Player.temp = "Heal 2"
  BattleSpecialRangerStuff()
  }
}
function BattleSpecialRangerHeal3()
{
CheckMp("Lv4.5");
  if (Player.needmp > Player.actmp)
  {
  Talk_Window("You don't have enough Mp!", "blank.png");
  GoToActivePlayer();
  }
  else
  {    
  Player.temp = "Heal 3"
  BattleSpecialRangerStuff()
  }
}
function BattleSpecialRangerStuff()
{
Player.mathtemp = Math.random()/5 + 0.9;
GetMagStats()
  if (Player.temp == "Heal")
  {
  Player.attackdamage = Math.floor(Player.mattacktemp*(Math.random()/5 + 0.9)*1);
  ReduceMp("Lv1");
  HealAllPlayerTarget();
  }
  else if (Player.temp == "Heal 2")
  {
  Player.attackdamage = Math.floor(Player.mattacktemp*(Math.random()/5 + 0.9)*7);
  ReduceMp("Lv3");
  HealAllPlayerTarget();
  }
  else if (Player.temp == "Heal 3")
  {
  Player.attackdamage = Math.floor(Player.mattacktemp*(Math.random()/5 + 0.9)*20);
  ReduceMp("Lv4.5");
  HealAllPlayerTarget();
  }
}





//Just needed a little more space in the Menu2.js script...

function Menu_Special()
{
Player.BPMenuTemp = true;
  RenderMap();
  
  WindowStyle.drawWindow(8, 8, 35, 12);
  Font.drawText(10, 10, "Who?");
    
  var ItemMenu = new BMenu();
  ItemMenu.font         = Font;
  ItemMenu.window_style = WindowStyle;
  ItemMenu.arrow        = Arrow;

  ItemMenu.addItem(Player.name, GameMenuSpecial1);   

  if (Player2.pres == true)
  {
    ItemMenu.addItem(Player2.name, GameMenuSpecial2);   
  }    
  if (Player3.pres == true)
  {
    ItemMenu.addItem(Player3.name, GameMenuSpecial3);   
  }    
    ItemMenu.addItem("Cancel", GameMenu);
    ItemMenu.execute(6, 34, 272, 40);
  
}

function GameMenuSpecial1()
{
  Player.temp = Player.chrclass;
  Player.active = "Player1";
  GameMenuSpecial();
}
function GameMenuSpecial2()
{
  Player.temp = Player2.chrclass;
  Player.active = "Player2";
  GameMenuSpecial();
}
function GameMenuSpecial3()
{
  Player.temp = Player3.chrclass;
  Player.active = "Player3";
  GameMenuSpecial();
}

function SpecialThing(name, description, mpcost, effect)
{
RenderMap() 
WindowStyle.drawWindow (25, 380, 590, 80);
Font.drawTextBox (45, 380, 500, 60, 5, name);
Font.drawTextBox (45, 390, 500, 60, 5, "Mp Cost: " + mpcost);
Font.drawTextBox (45, 410, 500, 60, 5, description);
Font.drawTextBox (45, 440, 500, 60, 5, effect);
FlipScreen();
while (IsKeyPressed(KEY_SPACE) == false) 
{Delay(100);}
{GetKey()}

GameMenuSpecial();
}

function GameMenuSpecialSoldierDash()
{
SpecialThing("Dash", "An elementary soldier technique in which the soldier dashes at a target.", 2, "Damages one target.")
}

function GameMenuSpecialDualCombo()
{
SpecialThing("Dual Combo", "A quick technique that hits a target twice.", 5, "Damages one target.")
}

function GameMenuSpecialSwordDrain()
{
SpecialThing("Sword Drain", "A technique that damages one target and heals the soldier by the amount damage taken out.", 12, "Drains hp from one target.")
}

function GameMenuSpecialCharge()
{
SpecialThing("Charge", "A more advanced version of the dash.", 15, "Damages all targets.")
}

function GameMenuSpecialQuadSlice()
{
SpecialThing("Quad Slice", "A more advanced version of the dual combo that hits a target four times.", 25, "Damages one target.")
}


function GameMenuSpecialRangerPeep()
{
SpecialThing("Peep", "A natural ranger ability that lets the ranger see a target's stats.", "None", "Sees stats of one target.")
}
function GameMenuSpecialRangerAnimals()
{
SpecialThing("Animals", "A ranger ability that calls on nearby animals to attack the enemy.", "None", "Attacks all targets.")
}
function GameMenuSpecialRangerDefup()
{
SpecialThing("Defense-Up", "A ranger ability that raises a person's defense.", "15", "Raises defense for one person.")
}
function GameMenuSpecialRangerPowerup()
{
SpecialThing("Power-Up", "A ranger ability that raises a person's attack power.", "15", "Raises attack for one person.")
}
function GameMenuSpecialRangerEvade()
{
SpecialThing("Evade-Up", "A ranger ability that raises a person's evade.", "15", "Raises evade for one person.")
}
function GameMenuSpecialRangerHeal()
{
SpecialThing("Heal", "A simple technique that can heal all party members.  Only usuable in battle.", "5", "Recovers hp of party.")
}
function GameMenuSpecialRangerHeal2()
{
SpecialThing("Heal 2", "A higher level version of the heal technique.  Only usuable in battle.", "30", "Recovers hp of party.")
}
function GameMenuSpecialRangerHeal3()
{
SpecialThing("Heal 3", "The most adavanced version of the heal technique.  Only usuable in battle.", "60", "Recovers hp of party.")
}

function GameMenuSpecialRangerEncounter()
{
  if (Player.active == "Player1")
  {
  Player.temphp = Player.hp;
  }
  else if (Player.active == "Player2")
  {
  Player.temphp = Player2.hp;
  }
  else 
  {
  Player.temphp = Player3.hp;
  }

RenderMap() 
WindowStyle.drawWindow (25, 380, 590, 80);
Font.drawTextBox (45, 380, 500, 60, 5, "Encounter");
Font.drawTextBox (45, 390, 500, 60, 5, "Mp Cost: None");
Font.drawTextBox (45, 410, 500, 60, 5, "A ranger ability that allows for more or fewer monster encounters.");
Font.drawTextBox (45, 440, 500, 60, 5, "Changes encounter rate");

  if (Player.temphp > 0)
  {
  WindowStyle.drawWindow (465, 300, 150, 10);
  Font.drawText(468, 301, "Change to:");

  var EncounterMenu = new Menu();
  EncounterMenu.font         = Font;
  EncounterMenu.window_style = WindowStyle;
  EncounterMenu.arrow        = Arrow;

  EncounterMenu.addItem("Very High", GameMenuEncounterVhigh);   
  EncounterMenu.addItem("High", GameMenuEncounterHigh);   
  EncounterMenu.addItem("Normal", GameMenuEncounterNormal);   
  EncounterMenu.addItem("Low", GameMenuEncounterLow);   
  EncounterMenu.addItem("Very Low", GameMenuEncounterVlow);   
  EncounterMenu.addItem("Cancel", GameMenuSpecial);
  EncounterMenu.execute(465, 320, 150, 50);
  }
  else
  {
  FlipScreen();
  eatKey();
  GetKey();
  }
}

function GameMenuEncounterVhigh()
{
Talk_Window("Encounter rate set to very high.", "blank.png");
Player.engage = 30;
GameMenuSpecial();
}
function GameMenuEncounterHigh()
{
Talk_Window("Encounter rate set to high.", "blank.png");
Player.engage = 40;
GameMenuSpecial();
}
function GameMenuEncounterNormal()
{
Talk_Window("Encounter rate set to normal.", "blank.png");
Player.engage = 60;
GameMenuSpecial();
}
function GameMenuEncounterLow()
{
Talk_Window("Encounter rate set to low.", "blank.png");
Player.engage = 90;
GameMenuSpecial();
}
function GameMenuEncounterVlow()
{
Talk_Window("Encounter rate set to very low.", "blank.png");
Player.engage = 120;
GameMenuSpecial();
}

function HealPlayerTarget()
{
RenderMap();
  if (Player.playertemp == "Player1")
  {
  Player.hp = Player.hp + Player.attackdamage;
    if (Player.hp >= Player.maxhp)
    {
    Player.hp = Player.maxhp
    }   
  UpdatePlayers();
  RenderMap();
  WindowStyle.drawWindow(5, 5, 235, 12);
  Font.drawText(7, 7, Player.temp);
  HpFont.drawTextBox (Player.P1x, Player.P1y, 500, 100, 5, Player.attackdamage);
  DrawPlayerStats();
  BattleName();
  FlipScreen();
  Delay(1000);
  }  
  if (Player.playertemp == "Player2")
  {
  RenderMap();
  Player2.hp = Player2.hp + Player.attackdamage;
    if (Player2.hp >= Player2.maxhp)
    {
    Player2.hp = Player2.maxhp
    }
  UpdatePlayers();          
  WindowStyle.drawWindow(5, 5, 235, 12);
  Font.drawText(7, 7, Player.temp);
  HpFont.drawTextBox (Player.P2x, Player.P2y, 500, 100, 5, Player.attackdamage);
  DrawPlayerStats();
  BattleName();
  FlipScreen();
  Delay(1000);
  }  
  if (Player.playertemp == "Player3")
  {
  RenderMap();
  Player3.hp = Player3.hp + Player.attackdamage;
    if (Player3.hp >= Player3.maxhp)
    {
    Player3.hp = Player3.maxhp
    }
  UpdatePlayers();

  WindowStyle.drawWindow(5, 5, 235, 12);
  Font.drawText(7, 7, Player.temp);   
  HpFont.drawTextBox (Player.P3x, Player.P3y, 500, 100, 5, Player.attackdamage);
  DrawPlayerStats();
  BattleName();
  FlipScreen();
  Delay(1000);
  }  
BattleMenu_Itemused();
}
function HealAllPlayerTarget()
{
RenderMap();
Player.playertemp = "Player1";
  if (Player.hp > 0)
  {
  Player.attackdamage2 = Math.floor(Player.attackdamage*(Math.random()/5 + 0.9));
  Player.hp = Player.hp + Player.attackdamage2;
    if (Player.hp > Player.maxhp)
    {
    Player.hp = Player.maxhp
    }
  UpdatePlayers();
  RenderMap();
  WindowStyle.drawWindow(5, 5, 235, 12);
  Font.drawText(7, 7, Player.temp);
  HpFont.drawTextBox (Player.P1x, Player.P1y, 500, 100, 5, Player.attackdamage2);
  DrawPlayerStats();
  BattleName();
  FlipScreen();
  Delay(1000);
  }
  else
  {  
  RenderMap();
  WindowStyle.drawWindow(5, 5, 235, 12);
  Font.drawText(7, 7, Player.temp);
  HpFont.drawTextBox (Player.P1x, Player.P1y, 500, 100, 5, 0);
  DrawPlayerStats();
  BattleName();
  FlipScreen();
  Delay(1000);
  }  
Player.playertemp = "Player2";
  if (Player2.pres == true)
  {
    if (Player2.hp > 0)
    {
    Player.attackdamage2 = Math.floor(Player.attackdamage*(Math.random()/5 + 0.9));
    Player2.hp = Player2.hp + Player.attackdamage2;

      if (Player2.hp > Player2.maxhp)
      {
      Player2.hp = Player2.maxhp
      }

    UpdatePlayers();
    
    RenderMap();
    WindowStyle.drawWindow(5, 5, 235, 12);
    Font.drawText(7, 7, Player.temp);
    HpFont.drawTextBox (Player.P2x, Player.P2y, 500, 100, 5, Player.attackdamage2);
    DrawPlayerStats();
    BattleName();
    FlipScreen();
    Delay(1000);
    }
    else
    {
    RenderMap();
    WindowStyle.drawWindow(5, 5, 235, 12);
    Font.drawText(7, 7, Player.temp);    
    HpFont.drawTextBox (Player.P2x, Player.P2y, 500, 100, 5, 0);
    DrawPlayerStats();
    BattleName();
    FlipScreen();
    Delay(1000);
    }
  }
Player.playertemp = "Player3";
  if (Player3.pres == true)
  {
    if (Player3.hp > 0)
    {
    Player.attackdamage2 = Math.floor(Player.attackdamage*(Math.random()/5 + 0.9));
    Player3.hp = Player3.hp + Player.attackdamage2;

      if (Player3.hp > Player3.maxhp)
      {
      Player3.hp = Player3.maxhp
      }

    UpdatePlayers();
    
    RenderMap();
    WindowStyle.drawWindow(5, 5, 235, 12);
    Font.drawText(7, 7, Player.temp);
    HpFont.drawTextBox (Player.P3x, Player.P3y, 500, 100, 5, Player.attackdamage2);
    DrawPlayerStats();
    BattleName();
    FlipScreen();
    Delay(1000);
    }
    else
    {
    RenderMap();
    WindowStyle.drawWindow(5, 5, 235, 12);
    Font.drawText(7, 7, Player.temp);    
    HpFont.drawTextBox (Player.P3x, Player.P3y, 500, 100, 5, 0);
    DrawPlayerStats();
    BattleName();
    FlipScreen();
    Delay(1000);

    }
  }
BattleMenu_Itemused();
}

//Also needed some space in special.js


function ReduceMp(Mplevel)
{
  if (Mplevel == "Lv1")
  {
  Player.temp3 = 5;
  }
  else if (Mplevel == "Lv1.5")
  {
  Player.temp3 = 12;
  }
  else if (Mplevel == "Lv2")
  {
  Player.temp3 = 15;
  }
  else if (Mplevel == "Lv2.5")
  {
  Player.temp3 = 25;
  }
  else if (Mplevel == "Lv3")
  {
  Player.temp3 = 30;
  }
  else if (Mplevel == "Lv3.5")
  {
  Player.temp3 = 45;
  }
  else if (Mplevel == "Lv4")
  {
  Player.temp3 = 50;
  }
  else if (Mplevel == "Lv4.5")
  {
  Player.temp3 = 60;
  }
  else if (Mplevel == "Lv5")
  {
  Player.temp3 = 75;
  }
  else if (Mplevel == "Lv6")
  {
  Player.temp3 = 125;
  }
  else if (Mplevel == "Lv7")
  {
  Player.temp3 = 200;
  }

  if (Player.active == "Player1")
  {
  Player.mp = Player.mp - Player.temp3;
  }
  else if (Player.active == "Player2")
  {
  Player2.mp = Player2.mp - Player.temp3;
  }
  else if (Player.active == "Player3")
  {
  Player3.mp = Player3.mp - Player.temp3;
  }
}  

function CheckMp(levelmpneed)
{
  if (Player.active == "Player1")
  {
  Player.actmp = Player.mp;
  }
  else if (Player.active == "Player2")
  {
  Player.actmp = Player2.mp;
  }
  else if (Player.active == "Player3")
  {
  Player.actmp = Player3.mp;
  }
  
  if (levelmpneed == "Lv1")
  {
  Player.needmp = 5;
  }
  else if (levelmpneed == "Lv1.5")
  {
  Player.needmp = 12;
  }
  else if (levelmpneed == "Lv2")
  {
  Player.needmp = 15;
  }
  else if (levelmpneed == "Lv2.5")
  {
  Player.needmp = 25;
  }
  else if (levelmpneed == "Lv3")
  {
  Player.needmp = 30;
  }
  else if (levelmpneed == "Lv3.5")
  {
  Player.needmp = 45;
  }
  else if (levelmpneed == "Lv4")
  {
  Player.needmp = 50;
  }
  else if (levelmpneed == "Lv4.5")
  {
  Player.needmp = 60;
  }
  else if (levelmpneed == "Lv5")
  {
  Player.needmp = 75;
  }
  else if (levelmpneed == "Lv6")
  {
  Player.needmp = 125;
  }
  else
  {
  Player.needmp = 200;
  }
}
